import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import axios from 'axios'
import locale from "element-plus/lib/locale/lang/zh-cn"
import * as ElIconModules from '@element-plus/icons-vue'

const app = createApp(App)

//设置axios的请求根路径
axios.defaults.baseURL = '/api'

//每个组件可以通过this直接访问到全局挂载的自定义属性
app.config.globalProperties.$http = axios

//挂载icon
Object.keys(ElIconModules).forEach(function (key) {
    app.component(ElIconModules[key].name, ElIconModules[key])
})

//添加自带的store,element-ui和router组件
app.use(store).use(router).use(ElementPlus, { locale }).mount('#app')
